package com.cloud.quickcore.admin.controller;

import com.cloud.quickcommon.R;
import com.cloud.quickcore.admin.service.SysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 用户管理
 *
 * @author NiJo_H
 * @version 1.0
 * @date 2019/8/14 21:56
 */
@Api(tags = "后台-用户管理")
@RestController
@RequestMapping(value = "/admin/users")
@Slf4j
public class SysUsersControllr {

    @Autowired
    private SysUserService sysUserService;


    /**
     * 删除用户
     */
    @ApiOperation(value = "删除用户")
    @DeleteMapping
    public R<Void> romveSysUser(@RequestParam("id") String id) {
        sysUserService.romve(id);
        return R.ok();
    }

    /**
     * 更改用户角色
     */
    @ApiOperation(value = "更改用户角色")
    @PutMapping("/setRole/{id}")
    public R<Void> updateSysUserRole(@PathVariable String id, @RequestParam String roleCode) {
        sysUserService.updateSysUserRole(id, roleCode);
        return R.ok();
    }


}
